//配置对应路由
const express = require('express');
const router = express.Router();
const dbHelper = require('../server/dbConfig/dbHelper.js');

//引入md5
const md5 = require('blueimp-md5');
let key = require('../server/dbConfig/mysqlConfig').KEY;

//插入测试数据
router.get('/test',(req, res, next) => {
  debugger;
  console.log("/api/test.....")
  let sql = `insert into t_test(id,name,age,sex) values (?,?,?,?);`;
  let value = ['1','admin',18,'男'];
  dbHelper(sql,value).then(result => {
    console.log(result);
    res.json({
      status: result.code,
      msg: 'insert into success!!!',
    })
  }).catch(err => {
    console.log(err);
  })
})

module.exports = router;
